<script setup lang="ts">
import UserInfo from './user-info.vue'

const isExpand = ref<boolean>(true)

const emit = defineEmits<{
  (e: 'expand', isExpand: boolean): void
}>()

const handleExpand = () => {
  isExpand.value = !isExpand.value
  emit('expand', isExpand.value)
}
</script>

<template>
  <div class="nav-header">
    <el-icon class="fold-menu" @click="handleExpand">
      <IconEpFold v-if="isExpand" />
      <IconEpExpand v-else />
    </el-icon>
    <div class="content">
      <div class="breadcrumb">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/' }">homepage</el-breadcrumb-item>
          <el-breadcrumb-item
            ><a href="/">promotion management</a></el-breadcrumb-item
          >
        </el-breadcrumb>
      </div>
      <user-info />
    </div>
  </div>
</template>

<style lang="scss" scoped>
.nav-header {
  display: flex;
  width: 100%;
  .fold-menu {
    font-size: 30px;
    cursor: pointer;
  }
  .content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    padding: 0 20px;
  }
}
</style>
